package cn.zy.amyan.core.util;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.io.Input;
import com.esotericsoftware.kryo.io.Output;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;

/**
 * @author 子言
 * @date 2024/5/5 下午 15:16
 */
public class KryoSerializer implements AySerializer {

	@Override
	public <T> byte[] serializer(T obj) {
		return KryoUtil.writeObjectToByteArray(obj);
	}

	@Override
	public <T> T deserializer(byte[] bytes, Class<T> clazz) {
		return KryoUtil.readObjectFromByteArray(bytes, clazz);
	}
}
